﻿using WS.EKA.Model;
using System.Data.SqlClient;
using System;

namespace WS.EKA.DataAccess
{
    public class CollectContecxt : DBContext<Collect>
    {
        public static int Add(Collect collect)
        {
            string sql = @"insert into [ShopNum1_Collect](
                [Guid]
            ,[MemLoginID]
            ,[ProductGuid]
            ,[CollectTime]
            ,[IsAttention]
            ,[IsDeleted])
            values(@Guid,@MemLoginID,@ProductGuid,@CollectTime,0,0)
             ";
            SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("Guid",collect.Guid),
                    new SqlParameter("MemLoginID",collect.MemLoginID),
                    new SqlParameter("ProductGuid",collect.ProductGuid),
                    new SqlParameter("CollectTime",collect.CollectTime)
                };

            return CollectContecxt.ExecSQL(sql, parameters);
        }

        public static int Delete(Guid id, string memLoginID)
        {
            string sql = "delete from [ShopNum1_Collect] where [Guid]=@Guid and [MemLoginID] = @MemLoginID";
            SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("Guid",id),
                    new SqlParameter("MemLoginID",memLoginID)
                };
            return CollectContecxt.ExecSQL(sql, parameters);
        }
    }
}
